package com.fjl.filewriter;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class FileWriterTest {

	public static void main(String[] args) {
		
		try {
			BufferedWriter outXml = new BufferedWriter(new FileWriter("D:/FJL.xml"));
			outXml.write("<?xml version= \"1.0\" encoding=\"UTF-8\"?>");   
			outXml.newLine();   
			outXml.write("<people>");   
			  
			outXml.newLine();    
			outXml.write("<student>");    
			outXml.newLine();    
			outXml.write("<name>" + "TEST1"+ "</name>");    
			outXml.newLine();    
			outXml.write("<sex>" + "TEST2" + "</sex>");    
			outXml.newLine();    
			outXml.write("<age>" + "TEST3" + "</age>");    
			outXml.newLine();    
			outXml.write("</student>");     
			outXml.newLine();   
			outXml.write("</people>");   
			outXml.flush();  
			outXml.close();
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
